﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using BudgetManager.Domain;

namespace BudgetManager.UserControls
{
    public partial class UserControlViewValues : UserControl
    {
        public UserControlViewValues()
        {
           InitializeComponent();
           TypeState = State.ALL; //By default
          
        }
        public AbstractValue SelectedValue
        {
            get { return listBoxActivities.SelectedItem == null ? null : (AbstractValue)listBoxActivities.SelectedItem; }
        }

        public void LoadData()
        {
            if (TypeState == State.EXPENSE)
            {
                listBoxActivities.ItemsSource = AccountManager.SelectedAccount.GetExpensesOrderByDate();

            }
            if (TypeState == State.INCOME)
            {
                listBoxActivities.ItemsSource = AccountManager.SelectedAccount.GetIncomesOrderByDate();
            }
            if (TypeState == State.ALL)
            {
                listBoxActivities.ItemsSource = AccountManager.SelectedAccount.GetTopActivities();
            }
        }

        public State TypeState { get; set; }
        public enum State { ALL, EXPENSE, INCOME }
    }
   
}
